<%--
  Created by IntelliJ IDEA.
  User: maliangcheng
  Date: 2020/8/11
  Time: 21:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="head.jsp"%>
<html>
<head>
    <title>updateEmployees</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/resource/layui/css/layui.css" media="all">
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>修改个人信息</small>
                </h1>
            </div>
        </div>
    </div>
<%--    <form action="${pageContext.request.contextPath}/employees/UpdateEmployees" method="post">--%>
<%--        <input type="hidden" name="name" value="${employees.name}"/>--%>
<%--        联系电话：<input type="text" name="employeesContactPhone" value="${employees.employeesContactPhone}"/>--%>
<%--        住址：<input type="text" name="employeesContactAdd" value="${employees.employeesContactAdd}"/>--%>
<%--        密码：<input type="text" name="password" value="${employees.password }"/>--%>
<%--        <input type="submit" value="提交" />--%>
<%--    </form>--%>
    <form class="layui-form layui-form-pane" action="${pageContext.request.contextPath}/employees/UpdateEmployees" method="post">
        <input type="hidden" name="name" value="${employees.name}"/>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号码</label>
            <div class="layui-input-inline">
                <input type="text" name="employeesContactPhone" lay-verify="required" placeholder="${employees.employeesContactPhone}" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
                <input type="password" name="password" placeholder="${employees.password }" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">请务必填写用户名</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">住址</label>
            <div class="layui-input-inline">
                <input type="text" name="employeesContactAdd" placeholder="${employees.employeesContactAdd }" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门编号</label>
            <div class="layui-input-inline">
                <input type="text" name="departmentId" placeholder="${employees.departmentId }" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门名称</label>
            <div class="layui-input-inline">
                <input type="text" name="departmentName" placeholder="${employees.departmentName }" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门联系电话</label>
            <div class="layui-input-inline">
                <input type="text" name="departmentContactPhone" placeholder="${employees.departmentContactPhone }" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" lay-submit="">提交</button>
        </div>
    </form>
</div>
<script src="resource/layui/layui.js"></script>
<script src="../js/updateEmployees.js"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });

        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');

        //自定义验证规则
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,pass: [
                /^[\S]{6,12}$/
                ,'密码必须6到12位，且不能出现空格'
            ]
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });

        //监听指定开关
        form.on('switch(switchTest)', function(data){
            layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });

        //监听提交
        form.on('submit(demo1)', function(data){
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });

        //表单赋值
        layui.$('#LAY-component-form-setval').on('click', function(){
            form.val('example', {
                "username": "贤心" // "name": "value"
                ,"password": "123456"
                ,"interest": 1
                ,"like[write]": true //复选框选中状态
                ,"close": true //开关状态
                ,"sex": "女"
                ,"desc": "我爱 layui"
            });
        });

        //表单取值
        layui.$('#LAY-component-form-getval').on('click', function(){
            var data = form.val('example');
            alert(JSON.stringify(data));
        });

    });
</script>

</body>
</html>
